//
//  E7AIFunc.h
//  EndlessBattle
//
//  Created by cc on 12-4-15.
//  Copyright (c) 2012年 PalmGame. All rights reserved.
//

#ifndef EndlessBattle_E7AIFunc_h
#define EndlessBattle_E7AIFunc_h

#include "E7GameDefine.h"

class CE7AIFunc
{
private:
    typedef enum
    {
        AP_ZERO,

        AP_CREATE = 1,
        AP_CREATE_ATTACK             = 2,
        AP_CREATE_ATTACK_KILL        = 3,
        AP_CREATE_ATTACK_ATTACH_CELL = 4,
        AP_CREATE_ATTACK_ATTACH_TOWN = 5,
        AP_CREATE_ATTACK_DETACH_CELL = AP_CREATE_ATTACK_ATTACH_CELL,
        AP_CREATE_ATTACK_DETACH_TOWN = AP_CREATE_ATTACK_ATTACH_TOWN,

        AP_ATTACH_ONE = 1,
        AP_ATTACH_TWO = 2,

        AP_ATTACK             = AP_CREATE_ATTACK + 1,
        AP_ATTACK_KILL        = AP_CREATE_ATTACK_KILL + 1,
        AP_ATTACK_ATTACH_CELL = AP_CREATE_ATTACK_ATTACH_CELL + 1,
        AP_ATTACK_DETACH_CELL = AP_CREATE_ATTACK_DETACH_CELL + 1,
        AP_ATTACK_ATTACH_TOWN = AP_CREATE_ATTACK_ATTACH_TOWN + 1,
        AP_ATTACK_DETACH_TOWN = AP_CREATE_ATTACK_DETACH_TOWN + 1,

    } eAIPoint ;

    typedef list<sAIData*>      DATA_LIST ;

public:
    CE7AIFunc(int robotid) ;
    ~CE7AIFunc() ;

    void RunAI() ;
//    sAIData* GetResult() ;

private:
    bool GetResult_LV1() ;

private:
    void SelectUnitFromTown(CE7Town* pTown) ;
    void SelectCellFromTown(CE7Town* pTown) ;

    void ComputeAttackValue(int countryid, int townid, CE7Cell* pTarCell) ;
    void ComputeMoveValue(int countryid, int townid, CE7Cell* pTarCell) ;
    void ComputeAttachValue(int countryid, int townid, CE7Cell* pTarCell) ;

private:
    bool CheckAddedData(int cellid) ;
    bool CheckAddedUnit(int unitid) ;

private:
    int             m_nRobotID ;

    DATA_LIST       m_listData ;
    UNIT_ID_LIST    m_listUnitIDs ;
//    CELL_ID_LIST    m_listAttack ;
//    CELL_ID_LIST    m_listMove ;
} ;

#endif






















